package com.atguigu.userprofile.dao

import com.atguigu.userprofile.bean.{TagInfo, TaskInfo}
import com.atguigu.userprofile.util.MySqlUtil

object TaskInfoDao {
  def getTaskInfoById(taskId:String) : TaskInfo ={
    val sql = s"select * from task_info where id=$taskId"
    var taskInfo : TaskInfo =null;
    val maybeInfo: Option[TaskInfo] = MySqlUtil.queryOne(sql,classOf[TaskInfo],true)
    if(maybeInfo == None){
      throw new RuntimeException(s"no task for id:$taskId")
    }else{
      taskInfo= maybeInfo.get
    }
    taskInfo
  }
}
